package com.tmsps.ne4weixin.pay;

import com.alibaba.fastjson2.JSON;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * @Title:  PayReturnCode.java
 * @Package com.tmsps.ne4weixin.pay
 * @Description: 微信支付商户收到回调信息后，回复给微信的消息
 * @author: zhangwei
 * @date:   2020-04-18
 * @version  v1.0
 * @Copyright: 2020 TMSPS All rights reserved.
 */
@Getter
@Setter
@NoArgsConstructor
public class PayReturnCode {
	private String return_code;
	private String return_msg;
	
	public PayReturnCode(String return_code,String return_msg) {
		this.return_code = return_code;
		this.return_msg = return_msg;
	}
	
	public static String returnSuccess() {
		PayReturnCode pc = new PayReturnCode();
		pc.setReturn_code("SUCCESS");
		pc.setReturn_msg("OK");
		return JSON.toJSONString(pc);
	}
	
	public static String returnFail(String failMsg) {
		PayReturnCode pc = new PayReturnCode();
		pc.setReturn_code("FAIL");
		pc.setReturn_msg(failMsg);
		return JSON.toJSONString(pc);
	}
	
	public String toString() {
		return toJSON();
	}
	
	public String toJSON() {
		return JSON.toJSONString(this);
	}
}
